﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RPGNETContracts;

namespace RPGClient
{
    public class RPGNETResponse
    {
        public void Process(byte[] buffer, int length)
        {
            int offset = 0;
            byte scenario = BufferUtil.ByteFromBuffer(buffer, offset, out offset);
            byte command = BufferUtil.ByteFromBuffer(buffer, offset, out offset);
            byte error = BufferUtil.ByteFromBuffer(buffer, offset, out offset);

            if (scenario == RPGNET_SCENARIO.INIT)
            {
                if (command == RPGNET_CLIENT_REQUEST.LOGIN)
                {
                    uint playerId = BufferUtil.UIntFromBuffer(buffer, offset, out offset);
                    string playerName = BufferUtil.StringFromBuffer(buffer, offset, 32, out offset);
                    byte objectCount = BufferUtil.ByteFromBuffer(buffer, offset, out offset);
                    uint leftObjectId = BufferUtil.UIntFromBuffer(buffer, offset, out offset);
                    ushort leftModelId = BufferUtil.UShortFromBuffer(buffer, offset, out offset);
                    string leftModelName = BufferUtil.StringFromBuffer(buffer, offset, 32, out offset);
                }
            }
            else if (scenario == RPGNET_SCENARIO.GAME)
            {
            }
        }
    }
}
